package com.morningstar.flow.satoken;

import cn.dev33.satoken.stp.StpInterface;
import com.morningstar.system.api.feign.ISystemUserFeign;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * sa-token 权限管理实现类
 *
 * @author Admin
 */
@Slf4j
@Service
public class SaPermission implements StpInterface {

    @Resource
    private ISystemUserFeign systemUserFeign;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return systemUserFeign.getPermissionList(loginId.toString(), loginType);
    }

    /**
     * 获取角色权限列表
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return systemUserFeign.getRoleList(loginId.toString(), loginType);
    }
}
